﻿import com.dmotiko.mirador.*
import com.dmotiko.general.*
import mx.transitions.*
import mx.transitions.easing.*
import mx.utils.Delegate;

class MiradorOrganizacionNavBar
extends BaseClip {
	private var mcMain:MovieClip;
	private var mcAmbientacion:MovieClip;
	private var mcEntretenimientos:MovieClip;
	private var mcMusica:MovieClip;
	private var mcCalidad:MovieClip;
	private var lastBtn:MovieClip;
		
	private function initClip():Void {
		super.initClip();
		var root:MiradorOrganizacionNavBar = this;
		
		mcMain.value = MiradorOrganizacionEventos.MAIN;
		mcAmbientacion.value = MiradorOrganizacionEventos.AMBIENTACION;
		mcEntretenimientos.value = MiradorOrganizacionEventos.ENTRETENIMIENTOS;
		mcMusica.value = MiradorOrganizacionEventos.MUSICA;
		mcCalidad.value = MiradorOrganizacionEventos.CALIDAD;
		
		function btnRelease():Void {
			this._parent.childChanged(this);
		}
		
		function btnOut():Void {
			if (this.bActive) return;
			this.gotoAndStop(1);
		}
		
		function btnOver():Void	{
			this.gotoAndStop(2);
		}
		
		mcMain.onRollOver = 
		mcAmbientacion.onRollOver =
		mcEntretenimientos.onRollOver =
		mcMusica.onRollOver = 
		mcCalidad.onRollOver = btnOver;
		
		mcMain.onRollOut = 
		mcAmbientacion.onRollOut =
		mcEntretenimientos.onRollOut =
		mcMusica.onRollOut = 
		mcCalidad.onRollOut = btnOut;
		
		mcMain.onRelease = 
		mcAmbientacion.onRelease =
		mcEntretenimientos.onRelease =
		mcMusica.onRelease = 
		mcCalidad.onRelease = btnRelease;
	}
		
	private function childChanged( child ) {
		lastBtn.bActive = false;
		lastBtn.onRollOut();
		child.bActive = true;
		lastBtn = child;
		this.dispatchEvent( { type: BaseClipEvent.CHANGED, target: this, data: child.value } );
	}
	
}